package com.security.door.core.mybatis;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import lombok.Data;
import tk.mybatis.mapper.annotation.KeySql;

import javax.persistence.Id;
import java.io.Serializable;

@Data
public class Entity implements Serializable {
    /**
     * 实体Id
     */
    @Id
    @KeySql(useGeneratedKeys = true)
    private Long id;

    @Override
    public String toString() {
        // 会打印出null的字段
        return JSON.toJSONString(this, SerializerFeature.WriteMapNullValue,
                SerializerFeature.DisableCircularReferenceDetect);
    }
}
